<template>
  <!--弹出视频-->
  <zz-dialog
    title='视频'
    :showConfirm="false"
    :visible = playVisible
    @close = "close">
    <div style="width: 800px; height: 400px;">
      <zz-player
        style="height: 100%"
        :video="videoFile"
        :autoplay="false"
        :contextmenu="contextmenu"
        :screenshot= true
        ref="player">
      </zz-player>
    </div>
  </zz-dialog>
</template>

<script>
  import VueDPlayer from 'vue-dplayer'
  export default {
    name: '',
    data () {
      return {
        videoFile: {},
        playVisible: false,
        contextmenu: [
          {
            text: '',
            link: ''
          }
        ]
      }
    },
    components: {
      'zz-player': VueDPlayer
    },
    methods: {
      // 获取视频文件
      open (url) {
        this.$store.dispatch({
          type: 'downFile',
          fileUuid: url,
          th: 1
        }).then(res => {
          // Success handle
          this.playVisible = true
          this.videoFile.url = res
        }, err => {
          // Error handle
          this.$message.error(err)
        })
      },
      close () {
        this.playVisible = false
      }
    }
  }
</script>
